package com.cuoyi.coupon.mall.controller;

import com.cuoyi.coupon.mall.common.ApiResult;
import com.cuoyi.coupon.mall.common.Entry;
import com.cuoyi.coupon.mall.model.req.DictionaryListReq;
import com.cuoyi.coupon.mall.model.res.DictionaryResp;
import com.cuoyi.coupon.mall.service.DictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(value = "字典表接口", tags = "字典表接口")
@RequestMapping(value = Entry.ADMIN + "/dictionary")
public class DictionaryController {

    @Resource
    private DictionaryService dictionaryService;

    @PostMapping(value = "/getDataByType")
    @ApiOperation(value = "根据类型获取数据", notes = "根据类型获取数据")
    public ApiResult<List<DictionaryResp>> getDataByType(@RequestBody DictionaryListReq dictionaryListReq) {
        return ApiResult.ok(dictionaryService.getDataByType(dictionaryListReq));
    }

}
